<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Parent(name) {
            this.name = [name]
        }

        Parent.prototype.getName = function() {
            return this.name
        }

        function Child() {

            // 子类可以调用父类的方法
            Parent.call(this, '曹操')
        }

        const child1 = new Child()
        const child2 = new Child()
        child1.name[0] = '关羽'
        console.log(child1.name);
        console.log(child2.name);

        // 输出get.Name控制台报错说明，不能访问父类的原型属性
        child1.getName()

    </script>
</body>
</html>